package com.atguigu.demo;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @ClassName: Demo06Servlet
 * @Description:application保存作用域
 * @Author: wty
 * @Date: 2022/12/5
 */
@WebServlet("/demo06")
public class Demo06Servlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 获取application保存作用域保存的数据
        ServletContext application = request.getServletContext();
        Object uname = application.getAttribute("uname");
        System.out.println(uname);


    }
}
